﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace DAO
{
    public class DataProvider2
    {
        public static SqlConnection ConnectDB()
        {
            string connectionString;
            //if (db == false)
            //{
            //connectionString = @"Data Source=localhost;Initial Catalog=QL_DATMONAN_ERROR;user=sa;password=123456";
            connectionString = @"Data Source=.\SQL2012EXPRESS;Initial Catalog=QL_DATMONAN_ERROR;Integrated Security=True";
           
        
            //}
           // else
            //{
            //    connectionString = @"Data Source=localhost;Initial Catalog=QL_DATMONAN_FIXED;user=sa;password=123456";
            //}
            SqlConnection conn;
            conn = new SqlConnection(connectionString);
            conn.Open();
            return conn;
        }

        public static SqlConnection ConnectDB(int chedo)
        {
            string connectionString;
            if (chedo == 0)
            {
                //connectionString = @"Data Source=localhost;Initial Catalog=QL_DATMONAN_ERROR;user=sa;password=123456";
                connectionString = @"Data Source=.\SQL2012EXPRESS;Initial Catalog=QL_DATMONAN_ERROR;Integrated Security=True";
            }
            else
            {
                //connectionString = @"Data Source=localhost;Initial Catalog=QL_DATMONAN_FIXED;user=sa;password=123456";
                connectionString = @"Data Source=.\SQL2012EXPRESS;Initial Catalog=QL_DATMONAN_FIXED;Integrated Security=True";
            }
            SqlConnection conn;
            conn = new SqlConnection(connectionString);
            conn.Open();
            return conn;
        }
    }
}
